//
//  UIImageView+UIImageViewNightMode.m
//  NightModeDemo
//
//  Created by dllo on 15/12/11.
//  Copyright © 2015年 ZKJ. All rights reserved.
//

#import "UIImageView+UIImageViewNightMode.h"

@implementation UIImageView (UIImageViewNightMode)

- (void)nightMode {    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *mode = [user objectForKey:@"NightMode"];
    if (!self.maskView) {
        self.maskView = [[UIView alloc] initWithFrame:self.bounds];
        self.maskView.backgroundColor = [UIColor blackColor];
        self.maskView.alpha = 0.5;
        [self addSubview:self.maskView];
    }
    if ([mode isEqualToString:@"Night"]) {
        self.maskView.hidden = NO;
    } else {
        self.maskView.hidden = YES;
    }
}

@end
